r(X) :- not p(X), dom(X).

p(X) :- not q(X), dom(X).
q(X) :- not p(X), dom(X).

dom(X) :- constant(X).

constant(a).
constant(b).
constant(c).
